<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>SAIL开发日志 (1) | Laomo 的后院</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="今天应该是SAIL开发的第20天，也是我第一次写博客，markdown还不太会用，嘻嘻。 既然是第一篇关于SAIL的文章，我还是讲讲SAIL是啥吧。SAIL是一门编程语言，介绍完毕。 SAIL的向往SAIL是风帆的意思，SAIL 旨意让开发者既能像python那样，有各式各样的库和模块，也能像java那样，有这严谨的面向对象的编程范式。 可以说，SAIL是由一位热爱着 Python 的程序员设计出">
<meta property="og:type" content="article">
<meta property="og:title" content="SAIL开发日志 (1)">
<meta property="og:url" content="http://yoursite.com/2020/04/01/SAIL%E5%BC%80%E5%8F%91%E6%97%A5%E5%BF%97-1/index.html">
<meta property="og:site_name" content="Laomo 的后院">
<meta property="og:description" content="今天应该是SAIL开发的第20天，也是我第一次写博客，markdown还不太会用，嘻嘻。 既然是第一篇关于SAIL的文章，我还是讲讲SAIL是啥吧。SAIL是一门编程语言，介绍完毕。 SAIL的向往SAIL是风帆的意思，SAIL 旨意让开发者既能像python那样，有各式各样的库和模块，也能像java那样，有这严谨的面向对象的编程范式。 可以说，SAIL是由一位热爱着 Python 的程序员设计出">
<meta property="article:published_time" content="2020-04-01T01:00:00.000Z">
<meta property="article:modified_time" content="2020-04-09T15:07:27.901Z">
<meta property="article:author" content="Laomo.">
<meta property="article:tag" content="SAIL开发日志">
<meta name="twitter:card" content="summary">
  
    <link rel="alternate" href="/atom.xml" title="Laomo 的后院" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  
<link rel="stylesheet" href="/css/style.css">

<meta name="generator" content="Hexo 4.2.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Laomo 的后院</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-SAIL开发日志-1" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2020/04/01/SAIL%E5%BC%80%E5%8F%91%E6%97%A5%E5%BF%97-1/" class="article-date">
  <time datetime="2020-04-01T01:00:00.000Z" itemprop="datePublished">2020-04-01</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      SAIL开发日志 (1)
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>今天应该是SAIL开发的第20天，也是我第一次写博客，markdown还不太会用，嘻嘻。</p>
<p>既然是第一篇关于SAIL的文章，我还是讲讲SAIL是啥吧。<br>SAIL是一门编程语言，介绍完毕。</p>
<h2 id="SAIL的向往"><a href="#SAIL的向往" class="headerlink" title="SAIL的向往"></a>SAIL的向往</h2><p><code>SAIL</code>是风帆的意思，SAIL 旨意让开发者既能像python那样，有各式各样的库和模块，也能像java那样，有这严谨的面向对象的编程范式。</p>
<p><strong>可以说，SAIL是由一位热爱着 Python 的程序员设计出来的 Java</strong></p>
<p>来看看 SAIL Java Python 它们各自面向对象的<code>Hello World</code>实现</p>
<p>下面是 SAIL 编写的 Hello World 程序</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Hello</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="title">main</span><span class="params">(args []String)</span> </span>&#123;</span><br><span class="line">        Console.writeln(<span class="string">"Hello World"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>（我不会告诉你我用了Java的高亮方案（狗头保命））</p>
<p>下面是 Java 的 Hello World 程序</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Hello</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="string">"Hello World"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>看起来差不多的亚子，来看看Python的</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Hello</span>:</span></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">main</span><span class="params">(self, *args)</span>:</span></span><br><span class="line">        print(<span class="string">"Hello World"</span>)</span><br></pre></td></tr></table></figure>
<p>Python所需要的字符是最少的，Java是最多的，SAIL中规中矩</p>
<h2 id="在Java的基础上做精简"><a href="#在Java的基础上做精简" class="headerlink" title="在Java的基础上做精简"></a>在Java的基础上做精简</h2><p><strong><em>会Java的程序员，我敢打包票会写SAIL，因为他俩太像了</em></strong></p>
<p>SAIL 尽可能的做精简，有些东西不需要特殊表明的，就省下，例如<code>void</code>，尽管你可以显式指出<code>void</code>返回值。</p>
<p>当然，还有<code>var</code>语句<code>var a = 10;</code>，可以选择性地加上类型，若不给出类型，编译期会补上。</p>
<h2 id="一-new-多用"><a href="#一-new-多用" class="headerlink" title="一 new 多用"></a>一 new 多用</h2><p>new 是SAIL较为有趣的一个地方，虽然它的功能只有一个，就是实例化对象，但是用起来相比Java的 new ，体验上会有一点区别。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">new</span> override Runnable &#123;</span><br><span class="line">    <span class="keyword">while</span> socs.accept() &#123;</span><br><span class="line">        <span class="comment">// ...</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;.run()</span><br></pre></td></tr></table></figure>
<p>这是快速创建一个线程的方式，也是快速重载只有一个public方法的class或者interface的高效方法。（Kotlin在这一点做得很好）</p>
<h2 id="类型后置"><a href="#类型后置" class="headerlink" title="类型后置"></a>类型后置</h2><p><strong><em>为什么 SAIL 会选择“奇怪”的类型后置语法？</em></strong></p>
<p>理由很简单：<strong>好看，易读</strong></p>
<p>一段代码，若使用类型后置，读起来将会很顺口。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">public getAge() int;</span><br></pre></td></tr></table></figure>

<h2 id="收尾"><a href="#收尾" class="headerlink" title="收尾"></a>收尾</h2><p>说实话，我写作文最怕收尾了。<br>SAIL 作为一门编程语言，为开发者着想，特别是为开发者的眼睛着想。</p>
<blockquote>
<p>*一个注重代码简洁和美丽的人，设计出来的语言，估计也不会差到哪去。</p>
</blockquote>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2020/04/01/SAIL%E5%BC%80%E5%8F%91%E6%97%A5%E5%BF%97-1/" data-id="ck8swb2yt0000wds608mf8d6x" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/SAIL%E5%BC%80%E5%8F%91%E6%97%A5%E5%BF%97/" rel="tag">SAIL开发日志</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2020/04/02/%E5%81%9A%E8%97%95%E7%B2%89%E7%9A%84%E7%AC%AC236%E5%A4%A9/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          做藕粉的第236天
        
      </div>
    </a>
  
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/SAIL%E5%BC%80%E5%8F%91%E6%97%A5%E5%BF%97/" rel="tag">SAIL开发日志</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python%E6%95%99%E7%A8%8B/" rel="tag">python教程</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%93%AA%E5%90%92%E7%9B%B8%E5%85%B3/" rel="tag">哪吒相关</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%B5%81%E6%B0%B4%E8%B4%A6/" rel="tag">流水账</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%8A%B1%E9%87%8C%E8%83%A1%E5%93%A8/" rel="tag">花里胡哨</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/SAIL%E5%BC%80%E5%8F%91%E6%97%A5%E5%BF%97/" style="font-size: 10px;">SAIL开发日志</a> <a href="/tags/python%E6%95%99%E7%A8%8B/" style="font-size: 20px;">python教程</a> <a href="/tags/%E5%93%AA%E5%90%92%E7%9B%B8%E5%85%B3/" style="font-size: 10px;">哪吒相关</a> <a href="/tags/%E6%B5%81%E6%B0%B4%E8%B4%A6/" style="font-size: 15px;">流水账</a> <a href="/tags/%E8%8A%B1%E9%87%8C%E8%83%A1%E5%93%A8/" style="font-size: 10px;">花里胡哨</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/04/">April 2020</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2020/04/05/%E3%80%90LaTeX%E6%B5%8B%E8%AF%95%E3%80%91%E4%B8%80%E4%BA%9B%E8%91%97%E5%90%8D%E7%9A%84%E5%85%AC%E5%BC%8F/">【LaTeX测试】一些著名的公式</a>
          </li>
        
          <li>
            <a href="/2020/04/04/%E6%90%9E%E5%AE%9APython%E8%A3%85%E9%A5%B0%E5%99%A8%EF%BC%88%E4%B8%89%EF%BC%89%E5%AE%9E%E7%8E%B0property%E7%B1%BB/">搞定Python装饰器（三）实现property类</a>
          </li>
        
          <li>
            <a href="/2020/04/04/%E6%90%9E%E5%AE%9APython%E8%A3%85%E9%A5%B0%E5%99%A8%EF%BC%88%E4%BA%8C%EF%BC%89/">搞定Python装饰器（二）</a>
          </li>
        
          <li>
            <a href="/2020/04/04/%E3%80%90%E5%9B%BE%E7%89%87%E6%B5%8B%E8%AF%95%E3%80%91%E5%8F%AF%E7%88%B1%E7%9A%84%E5%90%92%E5%84%BF/">【图片测试】可爱的吒儿</a>
          </li>
        
          <li>
            <a href="/2020/04/03/%E6%90%9E%E5%AE%9APython%E8%A3%85%E9%A5%B0%E5%99%A8%EF%BC%88%E4%B8%80%EF%BC%89/">搞定 Python 装饰器（一）</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2020 Laomo.<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">

  
<script src="/fancybox/jquery.fancybox.pack.js"></script>




<script src="/js/script.js"></script>




  </div>
</body>
</html>